package com.example.smartcitymovie.common;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.example.smartcitymovie.R;


/**
 * @Author: Machu
 * @Time: 2022/2/14 9:14
 * @Description: 功能描述
 */
public class TitleBar extends LinearLayout {
    private View view;
    public TitleBar(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        view = LayoutInflater.from(context).inflate(R.layout.title_bar_layout,this);
        TypedArray typedArray = context.obtainStyledAttributes(attrs,R.styleable.TitleBar);
        if (typedArray!=null){
            String title = typedArray.getString(R.styleable.TitleBar_title);
            if (title!=null){
                 TextView TVTitleBar = (TextView) view.findViewById(R.id.TV_titleBar);
                 TVTitleBar.setText(title);
            }
        }
    }


}
